package com.ztx.service.manager.impl;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.ztx.model.ReportAllVO;
import com.ztx.pagemodel.easyui.DataGrid;
import com.ztx.pagemodel.easyui.PageHelper;
import com.ztx.service.manager.IBusinessService;

@Repository(IBusinessService.BEAN_ID)
public class BusinessServiceImpl implements IBusinessService {

	@Resource
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public DataGrid<ReportAllVO> queryBusiness(PageHelper ph, ReportAllVO params) {
		long total = sqlSessionTemplate.selectOne(ReportAllVO.class.getName()
				+ ".queryReportAllCount");
		List<ReportAllVO> list = sqlSessionTemplate.selectList(
				ReportAllVO.class.getName() + ".queryReportAll", params,
				ph.getRowBounds());
		DataGrid<ReportAllVO> datagrid = new DataGrid<>();
		datagrid.setTotal(total);
		datagrid.setRows(list);
		return datagrid;
	}
}
